local w = 500
local ui1 = class.panel:builder 
{
    x = 1920 - w,
    y = 80,
    w = w-32,
    h = 40,
    fdf = 'tooltip_backdrop1',
    ui2 = {
        type = 'panel',
        y = 40,
        w = w-32,
        h = 191,
        fdf = 'tooltip_backdrop1',
        
    }
}
local ui2 = ui1.ui2

local title = ui1:add_text('队伍信息',0,0,nil,nil,12,5)
local button = ui1:add_button([[ReplaceableTextures\CommandButtons\BTNSkillz.blp]],ui1.w,(ui1.h-28)/2,32,28)
function button:on_button_clicked()
    if ui2.show_flag then
        ui2:hide()
    else
        ui2:show()
    end
end
button:on_button_clicked()

local titles = {'玩家名','等级','专属','挑战','杀敌','战力'}
local texts = {}
for a=0,4 do
    texts[a] = {}
    local x = 5
    for b,name in ipairs(titles) do
        local w = 60
        if b==1 then
            w = 120
        end
        local text = ui2:add_text('-',x,a*36 + 5,w,35,10,5)
        if a==0 then
            text:set_text(name)
        elseif b==1 then
            text:set_text(ac.player[a]:get_color_name())
        end
        texts[a][b] = text
        x = x + w
    end
end

local index = 0
ac.hardware:on "界面绘制" (function ()
    for a=1,4 do
        local p = ac.player[a]
        local mb = texts[a]
        local hero = p.hero
        if hero then
            local dps1,dps2 = hero:get_test_dps()
            mb[2]:set_text(('%s'):format(hero.level))
            mb[3]:set_text(('%s'):format(hero:get_data('专属等级','0')))
            mb[4]:set_text(('%s'):format(hero:get_data('挑战层数','0')))
            mb[5]:set_text(('%0.f'):format(p:get_data('总杀敌',0)))
            mb[6]:set_text(('%s'):format(format_number1(math.max(dps1,dps2))))
        end
    end
end)